package com.itheima.controller;

import com.itheima.pojo.User;
import com.itheima.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * @作者 itcast
 * @创建日期 2020/10/15 10:46
 **/
@Controller
@RequestMapping("userIndex")
public class IndexController {
    @Autowired
    UserService userService;
    @GetMapping
    public String findAll(Map map){
        map.put("author","三毛");
        List<User> all = userService.findAll();
        map.put("list",all);
        return "index";
    }
}
